import request from "@/utils/request";
import { ApiReturn } from "@/utils/request";

export interface Notice {
  createTime?: string
  enableValue?: string
  enable: number
  id: number
  title: string
  updateTime: string
  url: string
  picture?: string
}

export interface ListNotice {
  data: Notice[],
  total: number
}

export class CarouselService {
  static async list(params: any): ApiReturn<ListNotice> {
    return request.get("/carousel", { params })
  }

  static async delete(ids: number[]): ApiReturn<any> {
    return request.delete("/carousel", { data: ids })
  }

  static async save(data: any): ApiReturn<any> {
    return request.post("/carousel", data)
  }

  static async edit(data: any): ApiReturn<any> {
    return request.put(`/carousel/${data.id}`, data)
  }

  static async upFile(params: any): ApiReturn<any> {
    return request.post("/carousel/images", params)
  }

  static async get(id: number): ApiReturn<Notice> {
    return request.get(`/carousel/${id}`)
  }
}